<?php 
	session_start();
	require_once("../bb_functions.php");
	require_once("../db_functions.php");
	
	$host = "localhost";
	$username = "";
	$userpass = "";
	
	
	$username = $_POST["username"];
	$userpass = $_POST["userpass"];

	$loginResult = teamInfoBB($username,$userpass);//loginBB($username,$userpass);
	
	if($loginResult == false) {
		$location = "location:../index.php?error=1";
	} else { 
		checkUserExists($username);
		$location = "location:../index.php?action=index";
	}	
		
	$_SESSION['user'] = $username;
	header($location);
	
	//header("location:../index.php");
	
?>